import request from '@/utils/request'
const api_name = '/manage/teacher/chapters'

export function getNestedList(courseId) {
  return request({
    url: `${api_name}/nested/${courseId}`,
    method: 'get'
  })
}

export function saveChapter(data) {
  return request({
    url: `${api_name}/`,
    method: 'post',
    data
  })
}

export function getChapterById(id) {
  return request({
    url: `${api_name}/${id}`,
    method: 'get'
  })
}

export function deleteChapterById(id) {
  return request({
    url: `${api_name}/${id}`,
    method: 'delete',
  })
}

export function updateChapterById(chapterId,data) {
  return request({
    url: `${api_name}/${chapterId}`,
    method: 'put',
    data
  })
}
